package main

import (
	//"os"
	"model"
	"dao"
	//"github.com/aliyun/aliyun-tablestore-go-sdk/sample"
	//"github.com/aliyun/aliyun-tablestore-go-sdk/tablestore"
)
func init(){
	model.DB.Init()
}
func main() {

	//defer model.DB.Close()
	// Replace the endpoint info
	//endpoint := os.Getenv("OTS_TEST_ENDPOINT")
	//instanceName := os.Getenv("OTS_TEST_INSTANCENAME")
	//accessKeyId := os.Getenv("OTS_TEST_KEYID")
	//accessKeySecret := os.Getenv("OTS_TEST_SECRET")
	//client := tablestore.NewClient(endpoint, instanceName, accessKeyId, accessKeySecret)

	dao.UpdateRowWithIncrement(model.DB.Self, "sampletable")
	//return
	// Table operation
	//dao.CreateTableSample(model.DB.Self, "sampletable")
	//dao.CreateTableKeyAutoIncrementSample(model.DB.Self)
	//dao.DeleteTableSample(model.DB.Self)
	//dao.ListTableSample(model.DB.Self)
	//dao.UpdateTableSample(model.DB.Self, "sampletable")
	//dao.DescribeTableSample(client, "sampletable")

	// Single row operation
	dao.PutRowSample(model.DB.Self, "sampletable")
	dao.UpdateRowSample(model.DB.Self, "sampletable")
	dao.GetRowSample(model.DB.Self, "sampletable")
	dao.DeleteRowSample(model.DB.Self, "sampletable")
	//dao.PutRowWithKeyAutoIncrementSample(model.DB)

	// Multi row operation
	//dao.BatchWriteRowSample(model.DB.Self, "sampletable")
	//dao.BatchGetRowSample(model.DB.Self, "sampletable")
	//dao.GetRangeSample(model.DB.Self, "sampletable")

	// Stream sample
	// dao.GetStreamRecordSample(model.DB.Self, "streamtable1")

	//// computeSplitpoint
	//dao.ComputeSplitPointsBySize(model.DB.Self, "sampletable")
	//
	//// transaction
	//dao.PutRowWithTxnSample(model.DB.Self, "transtable1")
	//
	//// globalindex
	//dao.CreateTableWithGlobalIndexSample(model.DB.Self, "globalindex1")
	//
	////SearchIndex: agg & group by
	//dao.CreateSearchIndexForAggregationAndGroupBy(model.DB.Self, "agg_sample_table", "agg_sample_index")
	//dao.WriteDataForAggregationAndGroupBy(model.DB.Self, "agg_sample_table")
	//dao.AggregationSample(model.DB.Self, "agg_sample_table", "agg_sample_index")
	//dao.GroupBySample(model.DB.Self, "agg_sample_table", "agg_sample_index")
}

